home *** CD-ROM | disk | FTP | other *** search
/ Resource Library: Multimedia / Resource Library: Multimedia.iso / sgml / msdos / sgml07 / entity.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-03-22  |  9.3 KB  |  193 lines

  1. /* Struct dcncb: attribute list added to support data attributes.             */
  2. #ifndef ENTITY_H              /* Don't include this file more than once. */
  3. #define ENTITY_H
  4. /* ENTITY.H: Definitions and control block templates for entity management.
  5. */
  6. #include "tools.h"            /* Definitions for type declarations, etc. */
  7. #include "msgcat.h"
  8.  
  9. /* SGML Character Use
  10. */
  11. #define EOFCHAR   '\032'      /* FUNCTION: EE (entity end: files). */
  12. #define EOS         '\0'      /* NONCHAR: EE (entity end: strings). */
  13. #define EOBCHAR   '\034'      /* NONCHAR: EOB (file entity: end of buffer. */
  14. #define RSCHAR    '\012'      /* FUNCTION: RS (record start). */
  15. #define RECHAR    '\015'      /* FUNCTION: RE (record end). */
  16. #define TABCHAR   '\011'      /* FUNCTION: TAB (horizontal tab). */
  17. #define SPCCHAR   '\040'      /* FUNCTION: SPACE (horizontal space). */
  18. #define GENRECHAR '\010'      /* NONCHAR: Generated RE. */
  19. #define BADCHAR      '\001'      /* NONCHAR: Canonical non-SGML char */
  20.  
  21. #define AVALCASE      2       /* 2=untranslated string of name characters. */
  22.  
  23. /* Reference value of NAMELEN. */
  24. #define REFNAMELEN 8
  25.  
  26. /* Minimization status of returned tags.
  27. */
  28. #define MINNONE 0             /* Minimization: tag not minimized. */
  29. #define MINNULL 1             /* Minimization: tag was null. */
  30. #define MINNET  2             /* Minimization: end-tag was NET delimiter. */
  31. #define MINDATA 3             /* Minimization: end-tag was data tag. */
  32. #define MINSTAG 4             /* Minimization: tag implied by start-tag. */
  33. #define MINETAG 5             /* Minimization: end-tag implied by end-tag. */
  34.  
  35. /* Formal public identifier public text classes.
  36. */
  37. #define FPICAP         1
  38. #define FPICHARS       2
  39. #define FPINOT         3
  40. #define FPISYN         4
  41. #define FPICMINV       5      /* Minimum fpic value for versionable text. */
  42. #define FPIDOC         5
  43. #define FPIDTD         6
  44. #define FPIELEM        7
  45. #define FPIENT         8
  46. #define FPILPD         9
  47. #define FPINON        10
  48. #define FPISHORT      11
  49. #define FPISUB        12
  50. #define FPITEXT       13
  51. struct fpi {                  /* Formal public identifier. */
  52.      UNCH fpiot;              /* Owner type: + or - or ! (for ISO). */
  53.      UNS fpiol;              /* Length of owner identifier. */
  54.      UNS fpio;                /* Offset in pubis of owner identifier (no EOS).*/
  55.      int fpic;                /* Public text class. */
  56.      UNCH fpitt;              /* Text type: - or + (for available). */
  57.      UNS fpitl;              /* Length of text identifier. */
  58.      UNS fpit;                /* Offset in pubis of text identifier (no EOS). */
  59.      UNS fpill;              /* Language/designating sequence length. */
  60.      UNS fpil;                /* Offset in pubis of language. */
  61.      UNS fpivl;              /* Length of display version . */
  62.      UNS fpiv;                /* Offset in pubis of display version (no EOS). */
  63.      int fpiversw;          /* 1=use best ver; 0=use stated ver; -1=error. */
  64.      UNCH *fpinm;          /* Entity/DCN name (EOS, no length). */
  65.      UNCH fpistore;           /* 1=NDATA 2=general 3=parm 4=DTD 5=LPD 6=DCN. */
  66.      /* Name of the entity's DCN.  Valid only when fpistore == 1.
  67.     NULL if it's a SUBDOC. */
  68.      UNCH *fpinedcn;
  69.      UNCH *fpipubis; /* Public ID string (EOS). */
  70.      UNCH *fpisysis; /* System ID string (EOS). */
  71. };
  72. #define FPISZ sizeof(struct fpi)
  73. typedef struct fpi *PFPI;     /* Ptr to FPI control block. */
  74.  
  75. /* General control blocks.
  76. */
  77. #define NONONCH 1             /* Character references to non-chars invalid. */
  78. #define OKNONCH 0             /* Character references to non-chars allowed. */
  79. struct parse {                /* Parse control block. */
  80.      char   *pname;           /* Parse name; content, tag, etc. */
  81.      UNCH   *plex;            /* Lexical analysis table. */
  82.      UNCH   **ptab;           /* State and action table. */
  83.      UNS    state;            /* State. */
  84.      UNS    input;            /* Input. */
  85.      UNS    action;           /* Action. */
  86.      UNS    newstate;         /* Next state. */
  87. };
  88. struct restate {
  89.      UNS   sstate;            /* State. */
  90.      UNS   sinput;            /* Input. */
  91.      UNS   saction;           /* Action. */
  92.      UNS   snext;             /* Next state. */
  93. };
  94. struct map {
  95.      UNCH   *mapnm;           /* Name followed by EOS. */
  96.      int    mapdata;          /* Data associated with that name. */
  97. };
  98. struct hash {                 /* Dummy structure for function arguments. */
  99.      struct hash *enext;      /* Next entry in chain. */
  100.      UNCH *ename;          /* Entry name with size and EOS. */
  101. };
  102. typedef struct hash *PHASH;   /* Ptr to hash table entry. */
  103. typedef struct hash **THASH;  /* Ptr to hash table. */
  104.  
  105. struct fwdref {               /* A forward id reference. */
  106.      struct fwdref *next;     /* Pt to next reference in chain. */
  107.      UNIV msg;              /* Ptr to saved error messsage. */
  108. };
  109. #define FWDREFSZ sizeof(struct fwdref)
  110.  
  111. struct dcncb {                /* Data content notation control block. */
  112.      struct dcncb *enext;     /* Next DCN in chain. */
  113.      UNCH *ename;          /* Notation name followed by EOS. */
  114.      UNCH mark;              /* For use by application. */
  115.      UNIV dcnid;              /* DOS ID of full notation identifier. */
  116.      struct ad *adl;          /* Data attribute list (NULL if none). */
  117. };
  118. #define DCBSZ sizeof(struct dcncb)
  119. #define DCNMARK(p) ((p)->mark ? 1 : ((p)->mark = 1, 0))
  120.  
  121. typedef struct dcncb *PDCB;   /* Ptr to DCN control block. */
  122.  
  123. /* Number of capacities in a capacity set. */
  124.  
  125. #define NCAPACITY 17
  126.  
  127. struct sgmlcap {
  128.      char **name;
  129.      UNCH *points;
  130.      long *number;
  131.      long *limit;
  132. };
  133.  
  134. struct sgmlstat {             /* Document statistics. */
  135.      UNS dcncnt;              /* Number of data content notations defined. */
  136.      UNS pmexgcnt;            /* Number of plus or minus exception groups. */
  137.      UNS etdcnt;              /* Number of element types declared. */
  138.      UNS etdercnt;            /* Number of element types defined by default. */
  139.      UNS pmexcnt;             /* Number of plus/minus exception grp members. */
  140.      UNS modcnt;              /* Number of content model tokens defined. */
  141.      UNS attcnt;              /* Number of attributes defined. */
  142.      UNS attdef;              /* Characters of attribute defaults defined. */
  143.      UNS attgcnt;             /* Number of att value grp members (incl dcn). */
  144.      UNS idcnt;               /* Number of ID attributes specified. */
  145.      UNS idrcnt;              /* Number of ID references specified. */
  146.      UNS ecbcnt;              /* Number of entities declared. */
  147.      UNS ecbtext;             /* Characters of entity text defined. */
  148.      UNS srcnt;               /* Number of short reference tables defined. */
  149.      UNS dcntext;             /* Characters of notation identifiers defined. */
  150. };
  151. struct switches {             /* Parser control switches (1=non-standard). */
  152.      int swdupent;            /* 1=msg if duplicate ENTITY def attempted;0=no.*/
  153.      int swcommnt;            /* 1=return comment declarations as data; 0=no. */
  154.      int swrefmsg;            /* 1=msg if undeclared ref is defaulted; 0=no. */
  155.      UNS swbufsz;             /* Size of source file buffer for READ(). */
  156.      UNCH delcdata;           /* Delimiters: CDATA entity in att value. */
  157.      UNCH delsdata;           /* Delimiters: SDATA entity in att value. */
  158.      UNCH delnonch;           /* Prefix: non-SGML character. */
  159.      UNCH addnonch;           /* Addend: added to non-SGML char (mod 256). */
  160.      int swenttr;             /* 1=trace entity stack in error messages; 0=no.*/
  161.      int sweltr;          /* 1=trace element stack in error messages; 0=no. */
  162.      int swambig;          /* 1=check content model ambiguity */
  163.      char *prog;              /* Program name for error messages. */
  164.      char *trace;          /* What to trace in the body. */
  165.      char *ptrace;          /* What to trace in the prolog. */
  166.      nl_catd catd;          /* Message catalog descriptor. */
  167.      long nopen;          /* Number of open document entities */
  168.      int onlypro;          /* Parse only the prolog. */
  169. };
  170. struct markup {               /* Delimiter strings for text processor. */
  171.      UNCH *cro;               /* LEXCON markup string: CRO        */
  172.      UNCH *dso;               /* LEXCON markup string: DSO        */
  173.      UNCH *ero;               /* LEXCON markup string: ERO        */
  174.      UNCH *etag;              /* LEXMARK markup string: end-tag   */
  175.      UNCH *lit;               /* LEXMARK markup string: LIT       */
  176.      UNCH *lita;              /* LEXMARK markup string: LITA      */
  177.      UNCH *mdc;               /* LEXCON markup string: MDC       */
  178.      UNCH *mdo;               /* LEXCON markup string: MDO       */
  179.      UNCH *mse;               /* LEXCON markup string: mse        */
  180.      UNCH *mss;               /* LEXCON markup string: mss        */
  181.      UNCH *mssc;              /* LEXCON markup string: mss CDATA  */
  182.      UNCH *mssr;              /* LEXCON markup string: mss RCDATA */
  183.      UNCH *pic;               /* LEXCON markup string: PIC        */
  184.      UNCH *pio;               /* LEXCON markup string: PIO        */
  185.      UNCH *refc;              /* LEXGRP markup string: REFC       */
  186.      UNCH *stag;              /* LEXMARK markup string: start-tag */
  187.      UNCH *tagc;              /* LEXMARK markup string: TAGC      */
  188.      UNCH *vi;                /* LEXMARK markup string: VI        */
  189.      int lennet;              /* LEXMARK markup string length: null end-tag. */
  190.      int lennst;              /* LEXMARK markup string length: null start-tag.*/
  191. };
  192. #endif /* ndef ENTITY_H */
  193.